package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 小程序码生成类型：1-活动分享，2-邀请商家，3-邀请商户，4-邀请经纪人，5-分享商家主页
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum WxMiniCodeShareTypeEnum {

    // IS_FEN=1,进行分佣，IS_FEN=0，不进行分佣
    // 活动分享
    ACTIVE_SHARE(1, "aId=ACTIVE_ID&code=CODE&gId=GROUP_ORDER_ID"),
    // 邀请商家
    INVITE_BUSINESS(2, "code=INVITE_URL_CODE&re=busi"),
    // 邀请商户
    INVITE_MERCHANT(3, "code=BUSINESS_CODE&re=busi"),
    // 邀请经纪人
    INVITE_AGENT(4, "code=BUSINESS_CODE&groupId=GROUP_ID"),
    // 分享商家主页
    BUSINESS_SHARE(5, "code=BUSINESS_ID"),
    // 分享商家积分商城主页
    BUSINESS_POINTS_MALL_SHARE(6, "id=BUSINESS_ID"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    WxMiniCodeShareTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static WxMiniCodeShareTypeEnum typeOf(Integer value) {
        WxMiniCodeShareTypeEnum[] values = WxMiniCodeShareTypeEnum.values();
        for (WxMiniCodeShareTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static WxMiniCodeShareTypeEnum typeOf(String name) {
        WxMiniCodeShareTypeEnum[] values = WxMiniCodeShareTypeEnum.values();
        for (WxMiniCodeShareTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
